/**
 * Created By zhangQ 2018/3/1
 */
import axiosUtils from '@/api/env/axiosEnv'

let customAxios = axiosUtils._initAxios()

export function sendSms (param) {
  return customAxios({
    url: '/sendSms',
    method: 'post',
    data: {
      mobilePhone: param.mobilePhone,
      type: param.type
    }
  })
}

export function appLogin (param) {
  return customAxios({
    url: '/appLogin',
    method: 'post',
    data: param
  })
}

export function logout () {
  return customAxios({
    url: '/logout',
    method: 'post'
  })
}

export function getInfo () {
  return customAxios({
    url: '/common/user/getUserMenus',
    method: 'post'
  })
}

export function refreshCache (loginName) {
  return customAxios({
    url: '/refreshCache',
    method: 'post'
  })
}

export function getChatList (param) {
  return customAxios({
    url: '/common/chat/getChatList',
    method: 'post'
  })
}

export function getChatInfo (param) {
  return customAxios({
    url: '/common/chat/getChatInfo',
    method: 'post',
    data: {
      type: param.type,
      id: param.id,
      page: param.page ? param.page : 1,
      pageSize: param.pageSize ? param.pageSize : 500
    }
  })
}

export function sendTextMsg (param) {
  return customAxios({
    url: '/common/chat/sendTextMsg',
    method: 'post',
    data: {
      toUserId: param.toUserId,
      content: param.content
    }
  })
}

export function getNewMsg (param) {
  return customAxios({
    url: '/common/chat/getNewMsg',
    method: 'post'
  })
}

export function sendTextMsg2 (param) {
  return customAxios({
    url: '/sendTextMsg',
    method: 'post',
    data: param
  })
}

export function getChatInfo2 (param) {
  return customAxios({
    url: '/getChatInfo',
    method: 'post',
    data: param
  })
}

export function getNewMsg2 (param) {
  return customAxios({
    url: '/getNewMsg',
    method: 'post',
    data: param
  })
}

// 到站卸车列表
export function getTrainOrderDetailCarriageListByPage (param) {
  return customAxios({
    url: '/main/trainOrderDetail/getTrainOrderDetailCarriageListByPage',
    method: 'post',
    data: param
  })
}

// 查看详情
export function getTrainOrderDetailByCarriageNo (param) {
  return customAxios({
    url: '/main/trainOrderDetail/getTrainOrderDetailByCarriageNo',
    method: 'post',
    data: param
  })
}

// 修改运单状态
export function stateConfirmMultiple (param) {
  return customAxios({
    url: '/main/trainOrderDetail/stateConfirmMultiple',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: param
  })
}

// 错误提交
export function errorSubmit (param) {
  return customAxios({
    url: '/main/trainOrderDetail/errorSubmit',
    method: 'post',
    data: param
  })
}

// 获取股道列表
export function getPositionTracks () {
  return customAxios({
    url: '/main/trainOrder/getPositionTracks',
    method: 'post'
  })
}
